package core.service.impl;

import core.dao.CustomerDao;
import core.pojo.Customer;
import core.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.core.internal.CustomizerRegistry;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class CustomerServiceImpl implements CustomerService {

    @Autowired
    private CustomerDao customerDao;

    @Override
    public List<Customer> findCustomer() {

        return customerDao.findCustomer();
    }

    @Override
    public void deleteById(int cid) {
        System.out.println(cid);

        customerDao.deleteById(cid);
    }

    @Override
    public void save(Customer customer) {
        customerDao.save(customer);
    }

    @Override
    public void update(Customer customer) {
        customerDao.update(customer);
    }

    @Override
    public Customer findById(int cid) {
        Customer customer = customerDao.findById(cid);
        return customer;
    }


}
